{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{% load origin static django_bootstrap5 %}
{% block title %}Add I-Ds to {{ session.meeting }} : {{ session.group.acronym }}{% endblock %}
{% block pagehead %}{{ form.media.css }}{% endblock %}
{% block content %}
    {% origin %}
    <h1>
        Add Internet-Drafts to  {{ session.meeting }}
        {% if session_number %}: Session {{ session_number }}{% endif %}
        <br>
        <small class="text-body-secondary">{{ session.group.acronym }}
            {% if session.name %}: {{ session.name }}{% endif %}
        </small>
    </h1>
    {% comment %} TODO: put the session name here or calculate the number at the meeting {% endcomment %}
    {% if session.is_material_submission_cutoff %}
        <div class="alert alert-warning my-3">
            The deadline for submission corrections has passed. This may affect published proceedings.
        </div>
    {% endif %}
    <div class="alert alert-info my-3">
        This form will link additional Internet-Drafts to this session with a revision of "Current at time of presentation". For more fine grained control of versions, or to remove an Internet-Draft from a session, adjust the sessions associated with an Internet-Draft from the Internet-Draft's main page.
    </div>
    <h2 class="mt-5">Internet-Drafts already linked to this session</h2>
    <table class="table table-sm table-striped tablesorter">
        <thead>
            <tr>
                <th scope="col" data-sort="num">Revision</th>
                <th scope="col" data-sort="document">Document</th>
            </tr>
        </thead>
        {% if already_linked %}
            <tbody>
                {% for sp in already_linked %}
                    <tr>
                        <td>
                            {% if sp.rev %}
                                -{{ sp.rev }}
                            {% else %}
                                (current)
                            {% endif %}
                        </td>
                        <td>{{ sp.document.title }} ({{ sp.document.name }})</td>
                    </tr>
                {% endfor %}
            </tbody>
        {% endif %}
    </table>
    <h2 class="mt-5">Additional Internet-Drafts to link to this session</h2>
    <form method="post">
        {% csrf_token %}
        {% bootstrap_form form %}
        <button class="btn btn-{% if session.is_material_submission_cutoff %}warning{% else %}primary{% endif %}"
                type="submit">
            Save
        </button>
        <a class="btn btn-secondary float-end"
           href="{% url 'ietf.meeting.views.session_details' num=session.meeting.number acronym=session.group.acronym %}">
            Back
        </a>
    </form>
{% endblock %}
{% block js %}{{ form.media.js }}{% endblock %}